package com.jinsilu.freight.ui.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.jinsilu.freight.R;
import com.jinsilu.freight.helper.ReplaceHelper;
import com.jinsilu.freight.http.response.BankInfoBean;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * 银行卡列表信息
 *
 * @author yangyang
 * @time 2020-11-10 16:00
 */
public class BankListAdapter extends BaseQuickAdapter<BankInfoBean, BaseViewHolder> {

    public BankListAdapter(@Nullable List<BankInfoBean> data) {
        super(R.layout.item_bank_list, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, BankInfoBean s) {
        holder.setText(R.id.bank_name, s.getBankName())
                .setText(R.id.bank_card_number, ReplaceHelper.bankCardFormat(s.getBankCard()));
        if (0 == s.getDefaultState()) {
            holder.setText(R.id.bank_pay_method, "默认")
                    .setImageResource(R.id.bank_manage_ic, R.drawable.bank_green_check_ic)
                    .setVisible(R.id.bank_manage_ic, true);
        }
        else {
            holder.setVisible(R.id.bank_pay_method, false)
                    .setVisible(R.id.bank_manage_ic, false);
        }
    }
}
